namespace org.jawk.jrt
{
	/// <summary>
	/// Similar to StringTokenizer, except that tokens are characters
	/// in the input string themselves.
	/// </summary>
	/// <remarks>
	/// Similar to StringTokenizer, except that tokens are characters
	/// in the input string themselves.
	/// <p>
	/// For Jawk, this class is used when NF == "".
	/// </remarks>
	public class CharacterTokenizer : java.util.IEnumeration<object>
	{
		private string input;

		private int idx = 0;

		/// <summary>Construct a CharacterTokenizer.</summary>
		/// <remarks>Construct a CharacterTokenizer.</remarks>
		/// <param name="input">The input string to tokenize.</param>
		public CharacterTokenizer(string input)
		{
			this.input = input;
		}

		// to satisfy the Enumeration<Object> interface
        public virtual bool HasMoreElements()
		{
			return idx < input.Length;
		}

		public virtual object NextElement()
		{
            return char.ToString(input[idx++]);
		}
	}
}
